﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Shapes;

namespace SwarmMappingAlpha
{
    public class Edge
    {
        private int _weight;
        private Node _startNode;
        private Node _endNode;
        public Line connectingLine;

        public Edge(int edgeWeight,Node startNode, Node endNode)
        {
            _weight = edgeWeight;
            _startNode = startNode;
            _endNode = endNode;

            if (startNode != null || endNode != null)
            {
                connectingLine = new Line();
                connectingLine.StrokeThickness = 1;
                connectingLine.Stroke = System.Windows.Media.Brushes.Green;
                connectingLine.Opacity = .8;
                connectingLine.X1 = _startNode.X;
                connectingLine.Y1 = MainWindow.worldHeight - _startNode.Y + 3;
                connectingLine.X2 = _endNode.X;
                connectingLine.Y2 = MainWindow.worldHeight - _endNode.Y + 3;
            }
        }

        public bool Contains(Node searchNode)
        {
            return (this.startNode.Equals(searchNode) || this.endNode.Equals(searchNode));
        }

        public int weight
        {
            get { return _weight; }
        }

        public Node startNode
        {
            get { return _startNode; }
        }

        public Node endNode
        {
            get { return _endNode; }
        }
    }
}

